// 用户接口管理
import request from "@/utils/request";

const API = {
  USER_LOGIN: "/user/login",
  USER_PAGE: "user/page",
  USER_GET_BY_ID: "/user/getById",
  USER_CREATE_OR_EDIT: "/user/createOrEdit",
  USER_REMOVE: "/user/remove",
  USER_ALLOC_ROLE: "/user/allocRole",
  USER_BATCH_REMOVE: "/user/batchRemove",
  USET_INFO: "/user/info",
};

export const userLogin = (data) => request.post(API.USER_LOGIN, data);

export const userPage = (data) => request.post(API.USER_PAGE, data);

export const userCreateOrEdit = (data) =>
  request.post(API.USER_CREATE_OR_EDIT, data);

export const userGetById = (id) => request.get(API.USER_GET_BY_ID + `/${id}`);

export const userRemove = (id) => request.delete(API.USER_REMOVE + `/${id}`);

export const userAllocRole = (data) => request.post(API.USER_ALLOC_ROLE, data);

export const batchRemove = (idList) =>
  request.delete(API.USER_BATCH_REMOVE, {
    data: idList,
  });

export const userInfo = () => request.get(API.USET_INFO);
